package com.resys.mappers;

import com.resys.entity.po.Customer;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

/**
 *  数据库操作接口
 */
public interface CustomerMapper<T,P> extends BaseMapper<T,P> {

	/**
	 * 根据CustomerId更新
	 */
	 Integer updateByCustomerId(@Param("bean") T t,@Param("customerId") String customerId);


	/**
	 * 根据CustomerId删除
	 */
	 Integer deleteByCustomerId(@Param("customerId") String customerId);


	/**
	 * 根据CustomerId获取对象
	 */
	 T selectByCustomerId(@Param("customerId") String customerId);


	/**
	 * 根据ClientName更新
	 */
	 Integer updateByClientName(@Param("bean") T t,@Param("clientName") String clientName);


	/**
	 * 根据ClientName删除
	 */
	 Integer deleteByClientName(@Param("clientName") String clientName);


	/**
	 * 根据ClientName获取对象
	 */
	 T selectByClientName(@Param("clientName") String clientName);
	 @Select("SELECT * FROM customer WHERE phone = #{phone}")
	 Customer selectByPhone(String phone);
     @Select("select count(*) from customer where lastlogin_at between #{start} and #{end}")
     Integer getCountLogin( LocalDateTime start, LocalDateTime end);

}
